namespace Datacollection.Services.Logging
{
    /// <summary>
    /// 日志服务定位器，用于全局访问日志服务
    /// </summary>
    public static class LogServiceLocator
    {
        private static ILoggerService _loggerService;

        /// <summary>
        /// 初始化日志服务
        /// </summary>
        /// <param name="loggerService">日志服务实例</param>
        public static void Initialize(ILoggerService loggerService)
        {
            _loggerService = loggerService;
        }

        /// <summary>
        /// 获取日志服务实例
        /// </summary>
        public static ILoggerService Logger
        {
            get
            {
                if (_loggerService == null)
                {
                    // 如果未初始化，创建默认的NLog服务实例
                    _loggerService = new NLogService();
                }
                return _loggerService;
            }
        }
    }
}
    